#include <stdio.h>
#include <stdlib.h>
#include "Structs.h"
#include "Pong3D.h"
#include <GL/glut.h>
#include <math.h>
#include <Windows.h>

void drawWalls(void)
{
	glPushMatrix();
	glBegin(GL_QUADS);
	glColor4fv(leftWall.color);
	glVertex3fv(leftWall.point0);
	glVertex3fv(leftWall.point1);
	glVertex3fv(leftWall.point2);
	glVertex3fv(leftWall.point3);

	glColor4fv(rightWall.color);
	glVertex3fv(rightWall.point0);
	glVertex3fv(rightWall.point1);
	glVertex3fv(rightWall.point2);
	glVertex3fv(rightWall.point3);

	glColor4fv(topWall.color);
	glVertex3fv(topWall.point0);
	glVertex3fv(topWall.point1);
	glVertex3fv(topWall.point2);
	glVertex3fv(topWall.point3);

	glColor4fv(bottomWall.color);
	glVertex3fv(bottomWall.point0);
	glVertex3fv(bottomWall.point1);
	glVertex3fv(bottomWall.point2);
	glVertex3fv(bottomWall.point3);
	glEnd();
	glPopMatrix();
}

void defineWalls()
{
	copyArray(leftWall.color, COLOR_RED_50, 4);


	leftWall.point0[0] = -WORLD_WIDTH/2;
	leftWall.point0[1] = WORLD_HEIGHT/2;
	leftWall.point0[2] = NEAR_PLANE;

	leftWall.point1[0] = -WORLD_WIDTH/2;
	leftWall.point1[1] = WORLD_HEIGHT/2;
	leftWall.point1[2] = FAR_PLANE;

	leftWall.point2[0] = -WORLD_WIDTH/2;
	leftWall.point2[1] = -WORLD_HEIGHT/2;
	leftWall.point2[2] = FAR_PLANE;

	leftWall.point3[0] = -WORLD_WIDTH/2;
	leftWall.point3[1] = -WORLD_HEIGHT/2;
	leftWall.point3[2] = NEAR_PLANE;

	copyArray(rightWall.color, COLOR_BLUE_50, 4);

	rightWall.point0[0] = WORLD_WIDTH/2;
	rightWall.point0[1] = WORLD_HEIGHT/2;
	rightWall.point0[2] = NEAR_PLANE;

	rightWall.point1[0] = WORLD_WIDTH/2;
	rightWall.point1[1] = WORLD_HEIGHT/2;
	rightWall.point1[2] = FAR_PLANE;

	rightWall.point2[0] = WORLD_WIDTH/2;
	rightWall.point2[1] = -WORLD_HEIGHT/2;
	rightWall.point2[2] = FAR_PLANE;

	rightWall.point3[0] = WORLD_WIDTH/2;
	rightWall.point3[1] = -WORLD_HEIGHT/2;
	rightWall.point3[2] = NEAR_PLANE;

	copyArray(bottomWall.color, COLOR_GREEN_50, 4);

	bottomWall.point0[0] = -WORLD_WIDTH/2;
	bottomWall.point0[1] = -WORLD_HEIGHT/2;
	bottomWall.point0[2] = NEAR_PLANE;

	bottomWall.point1[0] = -WORLD_WIDTH/2;
	bottomWall.point1[1] = -WORLD_HEIGHT/2;
	bottomWall.point1[2] = FAR_PLANE;

	bottomWall.point2[0] = WORLD_WIDTH/2;
	bottomWall.point2[1] = -WORLD_HEIGHT/2;
	bottomWall.point2[2] = FAR_PLANE;

	bottomWall.point3[0] = WORLD_WIDTH/2;
	bottomWall.point3[1] = -WORLD_HEIGHT/2;
	bottomWall.point3[2] = NEAR_PLANE;

	copyArray(topWall.color, COLOR_YELLOW_50, 4);

	topWall.point0[0] = -WORLD_WIDTH/2;
	topWall.point0[1] = WORLD_HEIGHT/2;
	topWall.point0[2] = NEAR_PLANE;

	topWall.point1[0] = -WORLD_WIDTH/2;
	topWall.point1[1] = WORLD_HEIGHT/2;
	topWall.point1[2] = FAR_PLANE;

	topWall.point2[0] = WORLD_WIDTH/2;
	topWall.point2[1] = WORLD_HEIGHT/2;
	topWall.point2[2] = FAR_PLANE;

	topWall.point3[0] = WORLD_WIDTH/2;
	topWall.point3[1] = WORLD_HEIGHT/2;
	topWall.point3[2] = NEAR_PLANE;
}